/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package beans;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author machine
 */
@Stateless
public class ColeccionesFacade extends AbstractFacade<Colecciones> implements ColeccionesFacadeLocal {
    @PersistenceContext(unitName = "videosJEE-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public ColeccionesFacade() {
        super(Colecciones.class);
    }

    @Override
    public Colecciones consultarColeccion(String idcoleccion) {
        
        Query query = em.createQuery( "SELECT c FROM Colecciones c WHERE c.idcolecciones = " + idcoleccion + " " );
        
        return (Colecciones) query.getSingleResult();
    }
    
}
